<?php
if(!Authenticate::isLogin()){
	throw new Exception('You not login');
}
if($_SERVER['REQUEST_METHOD']=='POST'){
	Account::instance()->edit(Authenticate::getId(), $_POST);
	header("Location: {$_SERVER['REQUEST_URI']}");
}
else{
	$account = Account::instance()->getOne(Authenticate::getId());
	unset($account['password']);
	View::display('user/menu', array());
	View::display('user/profile', array('account'=> $account));
}